<template>
  <button
    :class="[
      type,
      size,
      circle ? 'circle' : '',
      loading ? 'loading' : '',
      disabled ? 'disabled' : '',
    ]"
    :loading="loading"
    hover-class="button-hover"
    :disabled="disabled"
  >
    <text :class="[loading ? 'loading' : '']">
		<view style="display:flex;align-items:center">
			<slot></slot>
		</view>

    </text>
  </button>
</template>

<script>
export default {
  name: 'Picker',
  props: {
    type: {
      type: String,
      default: 'default',
    },
    size: {
      type: String,
      default: 'normal',
    },
    circle: {
      type: Boolean,
      default: false,
    },
    disabled: {
      type: [Boolean, String],
      default: false,
    },
    loading: {
      type: [Boolean, String],
      default: false,
    },
  },
  methods: {
    // triggerHandler(e) {
    //   if (this.loading) return;
    //   this.$emit('thClick');
    // },
  },
};
</script>

<style lang="scss" scoped>
button {
  color: #fff;
  outline: none;
  display: inline-flex;
  -webkit-align-items: center;
  -webkit-box-align: center;
  align-items: center;
  vertical-align: middle;
  font-size: 28rpx;
  height: 60rpx;
  justify-content: center;
  transition: opacity 0.2s;
  margin: 0;
  &:after {
    border: none;
  }
  &.text {
    color: #007aff;
    font-size: 26rpx !important;
    background: none;
    &.disabled {
      color: #909399;
    }
  }
  &.primary {
    background: #007aff;
  }
  &.success {
    background: #67c23a;
  }
  &.warning {
    background: #e6a23c;
  }
  &.info {
    background: #909399;
  }
  &.danger {
    background: #f56c6c;
  }
  &.default {
    background: #fff;
    border: 1px solid #dcdfe6;
    color: #606266;
    &.circle {
      border-radius: 30rpx;
    }
  }
  &.small {
    height: 48rpx;
    line-height: 48rpx;
    font-size: 23rpx;
    padding: 0 22rpx;
    border-radius: 8rpx;
    &.circle {
      border-radius: 24rpx;
    }
  }
  &.large {
    height: 80rpx;
    padding: 0 38rpx;
    border-radius: 8rpx;
    line-height: 80rpx;
    font-size: 28rpx;
    &.circle {
      border-radius: 40rpx;
    }
  }
  &.flex {
    width: 100%;
    height: 80rpx;
    padding: 0 38rpx;
    border-radius: 8rpx;
    line-height: 80rpx;
    font-size: 28rpx;
    &.circle {
      border-radius: 40rpx;
    }
  }
  text.loading {
    margin-left: 10rpx;
    opacity: 0.6;
  }
  &.loading {
    opacity: 0.8;
  }
  &.button-hover {
    transform: translate(1rpx, 1rpx);
  }
}
</style>
